import unittest
from api.ihrm_login_api import IhrmLoginApi
from common.assrt_login import assert_login
from parameterized import parameterized
from common.read_data import read_json


# 编写测试用例并断言
class TestIhrmLogin(unittest.TestCase):
    # 使用参数化，修改测试方法的参数，按顺序填写参数
    @parameterized.expand(read_json())
    def test_login_success(self, desc, resq_body, status_code, success, code, message):
        resp = IhrmLoginApi.ihrm_login_api(resq_body)
        # 断言
        assert_login(self, resp, status_code, success, code, message)
